<template>
  <view>
    <u-navbar
        title="反馈详情"
        placeholder
        titleStyle="color:black"
        leftIconColor="#000"
        auto-back
        bgColor="#FDE52F">
    </u-navbar>
    <view class="top">
      建议类型
      <text style="color: crimson">*</text>
      <view class="itemContent">
        <view class="itemType item_bg">
          {{ listType[detailData.type - 1] }}
        </view>
      </view>
    </view>
    <view class="content1">
      建议描述
      <text style="color: crimson">*</text>
      <view style="margin-top: 30rpx"></view>
      <text style="font-size: 29rpx;color: #333333">{{detailData.content}}</text>
    </view>
    <view class="content2">
      上传图片
      <text style="color: crimson">*</text>
      <view style="margin-top: 30rpx"></view>
      <view style="display: flex;flex-wrap: wrap;">
        <view class="img_item" v-for="(item, index) in detailData.imgs" :key="index+item">
          <u-image :show-loading="true" :src="item" width="120rpx" height="188rpx" radius="10rpx" bgColor="#F9F9F9"
                 style="border: #EEEEEE solid 1px;border-radius: 10rpx" mode="aspectFit"></u-image>
        </view>
      </view>
    </view>
    <view class="content3">
      <view>
        联系电话
        <text style="color: crimson">*</text>
      </view>
      <view class="input_content">
        <text style="font-size: 29rpx;color: #333333">{{ detailData.phone }}</text>
      </view>
    </view>
    <view class="content3" v-if="detailData?.link_order">
      <view>
        选择订单
        <text style="color: crimson">*</text>
      </view>
      <view class="input_content">
        <text style="color: #666666;font-size: 29rpx">{{ detailData?.link_order }}</text>
      </view>
    </view>
    <view class="bottom">
      <u-button :color="detailData.status === 0 || detailData.status === 1 ? '#FD8533' : detailData.status === 2 ? '#01C608': '#FFFFFF'"
                :customStyle="{marginTop: '20px',color: '#FFFFFF'}" size="large">
        {{ detailData.status === 0 || detailData.status === 1 ? '请耐心等待处理结果' : '已处理完成，感谢您的反馈' }}
      </u-button>
      <view style="background-color: #FFFFFF">
        <u-safe-bottom></u-safe-bottom>
      </view>
    </view>
  </view>
</template>
<script setup>
import {ref} from "vue";
import {detailAPI} from "../../services/me";
import {onLoad} from "@dcloudio/uni-app";

const listType = ref(['订单问题', '餐品问题', '商家问题', '程序BUG', '售后问题', '其他反馈'])
const detailData = ref({})

onLoad(async (options) => {
  console.log("onLoad", options)
  const res = await detailAPI(options.id)
  detailData.value = res.result
})
</script>


<style lang="scss">
page {
  background-color: #F6F6F6;
}
</style>

<style scoped lang="scss">
.top, .content1, .content2, .content3 {
  background-color: #FFFFFF;
  padding: 30rpx;
  margin-bottom: 20rpx;
  font-size: 30rpx;
}

.bottom {
  width: 100%;
  position: fixed;
  bottom: 0;
}

.itemContent {
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 0 auto;

  .itemType {
    background-color: #F6F6F6;
    border-radius: 10rpx;
    padding: 20rpx 56rpx;
    margin-top: 20rpx;
    margin-right: 26rpx;
    color: #666666;
    font-size: 26rpx;
  }

  .itemType:nth-of-type(3n) {
    margin-right: 0;
  }

  .item_bg {
    background-color: #FDE52F;
    color: black;
  }

  .item_bg1 {
    background-color: #F6F6F6;
  }
}

.content3 {
  display: flex;
  align-items: center;

  .input_content {
    margin-left: 20rpx;
    flex: 1;
  }
}

.img_item {
  margin-right: 14rpx;

  &:last-child {
    margin-right: 0;
  }

  .add {
    width: 128rpx;
    height: 228rpx;
    background-color: #F6F6F6;
    font-size: 88rpx;
    font-weight: lighter;
    display: flex;
    align-items: center;
    color: #999999;
  }
}
</style>
